local db = TUNING.MOD_AVATAR_BH_MOBIUS.badge.bh_mobius_energy
AddPrefabPostInit('bh_mobius',function (inst)
    if not TheWorld.ismastersim then
        return inst
    end
    inst:AddComponent("bh_mobius_energy")

    inst.flag_bh_mobius_energy = true

    inst:ListenForEvent('onhitother',
    ---comment
    ---@param inst ent
    ---@param data event_data_onhitother
    function (inst, data)
        if data then
            local damage = data.damage or 0
            if damage > 0 then
                if inst.components.bh_mobius_energy then
                    inst.components.bh_mobius_energy:DoDelta(damage)

                    inst.flag_bh_mobius_energy = false
                end
            end
        end
    end)

    inst:DoPeriodicTask(db.per,function ()
        if inst and inst.components.bh_mobius_energy then
            if inst.flag_bh_mobius_energy then
                inst.components.bh_mobius_energy:DoDelta(-db.consume)
            else
                inst.flag_bh_mobius_energy = true
            end
        end
    end)
end)